<template>
  <div id="container" style="height:400px;"></div>
</template>

<script>
export default {
  created() {
    console.log(this.$route.query.one, this.$route.query.two);
  },
  mounted() {
    setTimeout(() => {
      this.initMap();
    }, 2000);
  },
  methods: {
    initMap() {
      var map = new AMap.Map("container", {
        resizeEnable: true, //是否监控地图容器尺寸变化
        zoom: 11, //初始化地图层级
        center: [this.$route.query.two,this.$route.query.one], //初始化地图中心点
      });
      var marker = new AMap.Marker({
        position: new AMap.LngLat(this.$route.query.two,this.$route.query.one), // 经纬度对象，也可以是经纬度构成的一维数组[116.39, 39.9]
        title: "北京",
      });

      map.add(marker);
    },
  },
};
</script>